// 同步操作

const fs = require('fs');

fs.writeFileSync('./writeSync.txt', 'sync-text', 'utf8');

try {
  const res = fs.readFileSync('./writeSync.txt', 'utf8');
  console.log(res);
} catch (error) {
  console.log(error)
}